<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <title>众筹活动详情</title>
    <script src="javascript/jquery.min.js"></script>
    <script src="javascript/function.js"></script>
    <link rel="stylesheet" href="stylesheet/style_v1.1.css">
</head>
<body>
<div class="con padding-bottom50" id="activityDetailShow">
</div>

    <script>
    var activityId='<%=request.getParameter("parms.activityId")%>';
        $(function(){
        	queryActivityDetail();
           var jg_width= $('.zc-xq-sj').find('li').width();
            $('.zc-xq-sj').find('li').css({'height':jg_width/2+"px",'padding-top':(jg_width/4)-25+"px"});
        });
        function queryActivityDetail() {
       		var params = "parms.activityId=" + activityId;
        	$.ajax({
        				type : 'post',
        				url : 'cliffordAction!queryActivityDetail.action',
        				async : false,
       					data : params, // 传给action的参数
        				success : function(data) {
        					if (data.result == 1) {
        						if (data.resultData.size == '0') {
        							document.getElementById("activityDetailShow").innerHTML="";
        							alert("未获取到商品信息");
        						} else {
        							var list = data.resultData.datalist;
        							var html = "";
        							for ( var i = 0; i < list.length; i++) {
        								html += ' <div class="zc-xiangqing">';
        								html += '  <img src="'+list[i].zjfGoodsActivity.activityImg+'" alt="">';
        						    	html += '  <div class="zc-xqb">';
        						    	html += ' <p class="zc-name">'+list[i].zjfGoodsActivity.activityName+'</p>';
        						        	html += '  <p class="zc-title">'+list[i].zjfGoodsActivity.activityName+'</p>';
        						        	html += '    <ul class="zc-xq-sj">';
        						        	html += '      <li>';
        						            	html += '   <p>支持人数</p>';
        						                	html += '     <span>'+list[i].zjfGoodsActivityRecord.personcount+'</span>';
        						                	html += '   </li>';
        						            	html += '    <li>';
        						            	html += '      <p>当前折扣</p>';
        						            	 if( typeof(list[i].zjfGoodsActivity.discount) != "undefined"){
        						                	html += '       <span>'+list[i].zjfGoodsActivity.discount+'折</span>';
        						            	 }else{
        						            		 html += '       <span>6.5折</span>';
        						            	 }
        						                	html += '     </li>';
        						            	html += '      <li>';
        						            	html += '       <p>剩余天数</p>';
        						                	html += '     <span>'+changeDte(list[i].zjfGoodsActivity.activityEndTime)+'天</span>';
        						                	html += '    </li>';
        						            	html += '    </ul>';
        						        	html += '    <div class="zhongchou-jiage">';
        						        	html += '       <p class="je">￥<span>'+list[i].zjfGoodsActivityRecord.total+'</span>元</p>';
        						            	html += '      <span class="je-title">已筹的金额</span>';
        						            	html += '       <p class="je">￥<span>'+list[i].zjfGoodsActivityRecord.total+'</span>元</p>';
        						            	html += '      <span class="je-title">当前参与总金额</span>';
        						            	html += '     </div>';
//         						            	html += '     <div class="zhongchou-jianjie">';
//         						        	html += '          <p>'+list[i].zjfGoodsActivity.activityContent+'</p>';
//         						            	html += '       </div>';
//         						        	html += '       <a href="#" class="btn">查看众筹详情</a>';
        						        	html += '     </div>';
        						        	
        						    	html += '    <div class="col-12 padding-lr5 padding-bottom50">';
        						    	html += '        <div class="xiangmu-info">';
        						        	html += '           <div class="xmhb">';
        						            	html += '             <p>项目回报</p>';
        						                	html += '         </div>';
        						            	html += '    <div class="xm-text">';
//         						            	html += '      <p class="name">满1000元 9折</p>';
//         						                	html += '   <span class="num">464位支持者</span>';
//         						                	html += '    <p class="text">德国冰豹打造客厅式游戏环境，在沙发玩游戏，全套键盘鼠标垫充电接口设计，让玩家舒适享受电视游戏生活德国冰豹打造客厅式游戏环境，在沙发玩游戏，全套键盘鼠标垫充电接口设计，让玩家舒适享受电视游戏生活</p>';
        						                	html += '    <p class="text">'+list[i].zjfGoodsActivity.activityContent+'</p>';
        						                	html += ' </div>';
        						            	html += '  </div>';
        						        	html += '   </div>';
        						    	html += '  <div class="footer padding-lr5">';
        							html += '  <a href="forwardPageParam_activityPay.action?parms.activityId='+list[i].zjfGoodsActivity.activityId+'" class="btn" style="margin-top: 10px" >立即参加</a>';
        							html += ' </div>';
        							}
        							document.getElementById("activityDetailShow").innerHTML = html;
        						}
        					} else {
        						document.getElementById("activityDetailShow").innerHTML="";
        						alert(data.msg);
        					}
        				}
        			});
        }
        function changeDte(endDate){
        	var date = new Date();
        	var nowToday  = date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate();
        	return DateDiff(nowToday,endDate);
        } 
        function joinActivity(activityId){
        	alert("创建"+activityId+"活动记录");
        	var params = "parms.openId=" + "1";
        	params += "&parms.activity_id=" + activityId;
        	params += "&parms.money=" + "100";
        	$.ajax({
        				type : 'post',
        				url : 'cliffordAction!joinActivity.action',
        				async : false,
       					data : params, // 传给action的参数
        				success : function(data) {
        					if (data.result == 1) {
        						window.location.href="forwardPage_activityShowList.action";
        					} else {
        						alert(data.msg);
        					}
        				}
        			});
        }
    </script>
</body>
</html>